package com.ybfenpan.controller.admin.wealth;


import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ybfenpan.controller.core.BaseController;
import com.ybfenpan.model.Member;
import com.ybfenpan.model.log.LogDianzi;
import com.ybfenpan.model.log.LogMoneyTi;
import com.ybfenpan.model.log.LogShui;
import com.ybfenpan.service.MemberService;
import com.ybfenpan.service.log.LogMoneyTiService;
import com.ybfenpan.service.log.LogShuiService;
import com.ybfenpan.utils.MapUtil;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;










/**
 * Created by Administrator on 2016/3/25.
 */
@Controller
 
public class BuyShuiCommitController extends BaseController {
	@Resource
	private LogShuiService logShuiService;

	@Resource
	private MemberService memberService;
	
    @RequestMapping("admin/wealth/buyShuiCommitShow.shtml")
    public String show(ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
    
    	  Map formMap = getParameterMap(request);
          int id = MapUtil.getIntValue(formMap, "id");
          LogShui one=this.logShuiService.getByKey(id);
      	request.setAttribute("one", one);
    	 
		Member member=this.memberService.getByKey(one.getMemberId());
 
		request.setAttribute("memberLoginName", member.getLoginName());
		  
		  return "admin/wealth/buyShuiCommit";
        
		
     
    }
   
    @RequestMapping("admin/wealth/buyShuiCommit.shtml")
    public String add(ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
    

  	   Map formMap = getParameterMap(request);
       int id = MapUtil.getIntValue(formMap, "id");
       LogShui one=this.logShuiService.getByKey(id);
       logShuiService.updateCommitOne(one);
        return "redirect:buyShuiList.shtml";

    }
  
}
